Skip to content

kube-vip: add optional Prometheus metrics via Ansible variables#13229

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
isumitsolanki:issue_13220
May 19, 2026
Merged

kube-vip: add optional Prometheus metrics via Ansible variables#13229
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
isumitsolanki:issue_13220

Conversation

@isumitsolanki
Copy link
Copy Markdown
Contributor

@isumitsolanki isumitsolanki commented May 4, 2026

What type of PR is this?
/kind feature

What this PR does / why we need it:

Adds optional Prometheus metrics for the kube-vip static pod through Ansible variables. When kube_vip_metrics_enabled is true, the generated manifest sets the prometheus_server environment variable (from kube_vip_metrics_port, default 2112) and declares a named metrics container port so scrapers can treat the endpoint as documented. Defaults keep current behavior unchanged (kube_vip_metrics_enabled: false). Sample inventory comments and docs/ingress/kube-vip.md describe how to turn the feature on.

Which issue(s) this PR fixes:

Fixes #13220

Special notes for your reviewer:

The numeric containerPort is derived with regex_replace('^.*:', '') | int so bind strings such as 2112 or 0.0.0.0:2112 map to the correct port; plain numeric values still work. The pod remains hostNetwork: true; the port declaration is mainly for documentation and tooling that read the manifest.

Does this PR introduce a user-facing change?:

Kubespray: kube-vip static pod can optionally expose Prometheus metrics via `kube_vip_metrics_enabled` and `kube_vip_metrics_port` (see kube-vip docs and `docs/ingress/kube-vip.md`).

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 4, 2026
@k8s-ci-robot k8s-ci-robot requested a review from cyclinder May 4, 2026 09:02
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 4, 2026
@k8s-ci-robot k8s-ci-robot requested a review from yankay May 4, 2026 09:02
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 4, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @isumitsolanki. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cyclinder
Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 6, 2026
@yankay
Copy link
Copy Markdown
Member

yankay commented May 6, 2026

Nice work @isumitsolanki! Clean, backward-compatible addition with docs and a release note, and CI is all green.

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2026
@isumitsolanki
Copy link
Copy Markdown
Contributor Author

Thank you @yankay @cyclinder

@isumitsolanki
Copy link
Copy Markdown
Contributor Author

Hi @yankay , @cyclinder Is there anything pending from my end. please do let me know

Comment thread roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 Outdated
Comment thread docs/ingress/kube-vip.md Outdated
Comment thread roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 Outdated
Comment thread roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 Outdated
@tico88612
Copy link
Copy Markdown
Member

tico88612 commented May 14, 2026

BTW I didn't found kube-vip source code why default port is :9090, could you provide more informations?

@isumitsolanki
Copy link
Copy Markdown
Contributor Author

BTW I didn't found kube-vip source code why default port is :9090, could you provide more informations?

Hi @tico88612
9090 is a common convention people associate with Prometheus (the Prometheus server often uses 9090). It is a Kubespray / operator choice, not something copied from kube-vip’s default.

@tico88612
Copy link
Copy Markdown
Member

9090 is a common convention people associate with Prometheus (the Prometheus server often uses 9090). It is a Kubespray / operator choice, not something copied from kube-vip’s default.

9090 is usually the Prometheus port; the scrape port usually depends on the specific exporter.
However, kube-vip defaults to 2112, so let's just stick with that. I don't think we need to make a special change.

@yankay
Copy link
Copy Markdown
Member

yankay commented May 14, 2026

Agree with @tico88612 — 9090 is too commonly used by other Prometheus components and can easily clash.

@isumitsolanki
Copy link
Copy Markdown
Contributor Author

Yeah agree @tico88612 , @yankay
I have modified it according to default port 2112

@tico88612
Copy link
Copy Markdown
Member

tico88612 commented May 14, 2026

@isumitsolanki Please rebase and squash to one commit.

And edit your PR description.

Add kube_vip_metrics_enabled and kube_vip_metrics_port; wire
prometheus_server and container port in the static pod manifest.
Default metrics port to 2112 to match kube-vip upstream. Document
and sample inventory updated.
@isumitsolanki
Copy link
Copy Markdown
Contributor Author

@isumitsolanki Please rebase and squash to one commit.

And edit your PR description.

Hi @tico88612 , I have rebased and squash into single commit

@isumitsolanki isumitsolanki requested a review from tico88612 May 19, 2026 05:35
Copy link
Copy Markdown
Member

@tico88612 tico88612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: isumitsolanki, tico88612, yankay

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 7fd29b5 into kubernetes-sigs:master May 19, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for kube-vip prometheus metrics via configurable ansible variable

5 participants